package org.asg.dis.service;

import org.asg.dis.model.Courier;
import org.asg.dis.repository.CourierRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class CourierService {

    private final CourierRepository courierRepository;

    @Autowired
    CourierService(CourierRepository courierRepository){
        this.courierRepository = courierRepository;
    }


    public void cancel(String id) {
        //TODO 撤销订单
    }

    public void save(Courier c){
        courierRepository.save(c);
    }

    public Optional<Courier> findById(Long id){
        return courierRepository.findById(id);
    }

    public void delete(Courier c){
        courierRepository.delete(c);
    }

}
